package com.cfl.ticketmodule.controller;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cfl.model.TicketNumber;
import com.cfl.ticketmodule.service.TicketNumberService;

@Controller
public class TicketNumberController {

	@Autowired
	private TicketNumberService ticketNumberService;
	
	@RequestMapping("find_ticketnumber_number")
	@ResponseBody
	public Object findByNumber(String number) {
		try {
			return ticketNumberService.findByNumber(number);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@RequestMapping("findTicketnumberByTid")
	@ResponseBody
	public Object findByTid(String tid) {
		try {
			return ticketNumberService.findByTid(tid);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@RequestMapping("findTicketnumberByAll")
	@ResponseBody
	public Object findByAll() {
		try {
			return ticketNumberService.getAll();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new ArrayList<TicketNumber>();
	}
}
